var payInMoneyPwdCtrl;

$(function(){
	if($("#avaFlag").val()=="1"){
		payInMoneyPwdCtrl=new PwdControl("payPassword","payInMoneyPasswordDiv",222,28);
		$("#payInMoneyByGopaySubmitBt").removeAttr("disabled");
		$("#payInMoneyByGopaySubmitBt").html("确认支付");
	}
	$('input[name="otherPayInMoney"]').removeAttr("checked");
});

var payInMoneyByGopaySubmit = function(){
	$.get(ctx+"/getPayPwdUUID.shtml",{ts:new Date().getTime(),count:1,safe:1},function(r){
		if(r&&r.code1){
			payInMoneyPwdCtrl.encrypt(r.code1,1);
			$("#payInMoneyByGopaySubmitBt").attr("disabled","true");
			$("#payInMoneyByGopaySubmitBt").html("处理中..");
			$("#payInMoneyByGopayForm").submit();
		}else{
			$.alert("获取支付密码随机码失败");
		}
	},"json");
};

var otherPayTrigger = function(){
	var otherPay = $('input[name="otherPayInMoney"]:checked').val();
	var shortfallPayInput = "<input type='hidden' id='payWay' name='payWay' value='S'/> ";
	if(otherPay){
		$("#bankPayForm").append(shortfallPayInput);
		$("#allPersonBankPayForm").append(shortfallPayInput);
		$("#allCorpBankPayForm").append(shortfallPayInput);
	}else{
		$("#payWay").remove();
	}
};